import type { RouteRecordRaw } from 'vue-router'

// const modules: any = import.meta.glob('./modules/*.ts', { eager: true })
// const rolesRoutes: RouteRecordRaw[] = [...Object.keys(modules).map((key) => modules[key].default)]

import agent from './modules/agent'
import application from './modules/application'
import dataset from './modules/dataset'
import model from './modules/model'
import webapp from './modules/webapp'
const rolesRoutes: RouteRecordRaw[] = [agent, dataset, application, model, webapp]

export const routes: Array<RouteRecordRaw> = [
  {
    path: '/diy/chat/:accessToken',
    name: 'diy_chat',
    meta: { title: '智能体chat', activeMenu: '/diyChat' },
    component: () => import('@/views/diy/index.vue')
  },
  {
    path: '/',
    name: 'home',
    redirect: '/webapp/chat',
    children: [...rolesRoutes]
  },

  // 高级编排
  {
    path: '/application/:id/workflow',
    name: 'ApplicationWorkflow',
    meta: { activeMenu: '/application' },
    component: () => import('@/views/application-workflow/index.vue')
  },

  // {
  //   path: '/chat/:accessToken',
  //   name: 'Chat',
  //   component: () => import('@/views/chat/index.vue')
  // },

  
  // {
  //   path: '/webapp/chat',
  //   name: 'webappChat',
  //   component: () => import('@/views/webapp/chat.vue')
  // },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue')
  },
  {
    path: '/:pathMatch(.*)',
    name: '404',
    component: () => import('@/views/404/index.vue')
  }
]
